<?php
$id = isset($_GET['id']) ?  $_GET['id'] : '' ;
$pn = isset($_GET['pn']) ?  $_GET['pn'] : '' ;
if(!empty($id) && !empty($pn)) {
	$file_content = file_get_contents('test/test-' . $pn . '.html');
	$file_content = str_replace('<BODY ', '<BODY style="margin:0px 0px 10px 0px;text-align:center; width:100%" ', $file_content);
	$file_content = str_replace('src="', 'src="/reading/test/', $file_content);
	$file_content = str_replace(array(';left:','"><nobr><span'), array('px;left:','px;"><nobr><span'), $file_content);
	header("Content-type: text/html; charset=utf-8");
	echo $file_content;
	preg_match('/width:([0-9]+);height:([0-9]+);/i', $file_content, $arrMatch);
	echo '<script>parent.iframeSet('.$arrMatch[1].','.$arrMatch[2].');</script>';
}